from django.db import models

# Create your models here.
class BookInfo(models.Model):
    btitle=models.CharField(max_length=20)
    bpub_date=models.DateTimeField(db_column='pub_date')
    bread=models.IntegerField(default=0)
    bcommet=models.IntegerField(default=0)
    isDelete=models.BooleanField(default=False)
    # class Meta():
    # 可以自定义数据表的名称

class HeroInfo(models.Model):
    hname=models.CharField(max_length=20)
    hgender=models.BooleanField(default=True)
    isDelete=models.BooleanField(default=False)
    hcontent=models.CharField(max_length=1000)
    hbook=models.ForeignKey('BookInfo',on_delete=models.CASCADE)

    def showName(self):
        return self.hname

